Repository navigation
Test the schema warnings through a shared log-capture helper - #878
Merged
Merged
Conversation
…capture helper UnmappedInputFieldsTest's withWarnings moves to TestUtils and listens on the library's loggers instead of the root logger. The tests for unused types, allowUnimplementedResolvers, repeated enum values, interface fields and union members, extensions of a different kind and repeated non-repeatable directives now assert the exact warnings.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #867
Checklist
Description
We log a WARN for a bunch of schema problems we tolerate, but no test checked any of them. So a warning could disappear or change without anything failing.
UnmappedInputFieldsTestalready had awithWarnings { ... }helper from #857 that attaches a logbackListAppenderand returns the result along with the logged warnings. It's moved toTestUtils.ktas is, except it now listens on thegraphql.kickstart.toolslogger instead of the root one, so graphql-java's own warnings don't end up in the list.The tests that already build these schemas now assert the warnings too:
unused unions are reported by their definition and get the members of their extensions when includedrepeats and extensions without a type keep buildingextensions of a different kind than the type are ignoreddirectives of extensions follow those of the type and are wiredallowUnimplementedResolvershad no test of its own, soMissingFieldResolverTestgets one for the option's warning and the "Missing resolver for field" one.The lists are exact, so an extra warning fails the test as well as a missing one.
Test only, no library changes.
mvn clean verifypasses on JDK 25 and on JDK 11 against graphql-java 25.1.The other warnings (unused dictionary entries and resolvers, JDK proxies,
preferGraphQLResolver,setAccessiblefailures, the deprecated context ones) weren't in the issue and are still untested, butwithWarningsworks for those too.